﻿using System;
using System.Data;
using System.Collections;
using XmlParser;

namespace CommonUtilities.SchemaXML.WebThemes
{
    public class XmlWebThemes : XmlObject
    {
        #region Themes

        public Hashtable XmlThemes
        {
            get { return this.ChildrenNodes("Theme"); }
        }

        public XmlTheme XmlTheme(int index)
        {
            Hashtable ht = this.XmlThemes;
            Object obj = ht[index];

            if (obj != null && obj is XmlTheme)
            {
                XmlTheme xmlTheme = obj as XmlTheme;
                return xmlTheme;
            }
            else
            {
                return null;
            }
        }

        public bool RemoveXmlTheme(int index)
        {
            return this.RemoveChildNode(XmlTheme(index));
        }

        public bool AddXmlTheme(XmlTheme xmlTheme)
        {
            return this.AddChildNode(xmlTheme);
        }

        public XmlTheme this[int index]
        {
            get { return this.XmlTheme(index); }
        }

        #endregion Themes
    }

    public class XmlTheme : XmlObject
    {
        //Attribute
        #region Attributes

        public Hashtable XmlAttributes
        {
            get { return this.ChildrenNodes("Attribute"); }
        }

        public XmlAttribute XmlAttribute(int index)
        {
            Hashtable ht = this.XmlAttributes;
            Object obj = ht[index];

            if (obj != null && obj is XmlAttribute)
            {
                XmlAttribute xmlAttribute = obj as XmlAttribute;
                return xmlAttribute;
            }
            else
            {
                return null;
            }
        }

        public bool RemoveXmlAttribute(int index)
        {
            return this.RemoveChildNode(XmlAttribute(index));
        }

        public bool AddXmlAttribute(XmlAttribute xmlAttribute)
        {
            return this.AddChildNode(xmlAttribute);
        }

        public XmlAttribute this[int index]
        {
            get { return this.XmlAttribute(index); }
        }

        #endregion Attributes
    }

    public class XmlAttribute : XmlObject
    {
        #region Attributes

        public string Variable
        {
            get { return this.v_Attributes["variable"].ToString(); }
            set { this.v_Attributes["variable"] = value; }
        }

        #endregion Attributes
    }
}
